<template>
    <div class="">
        <div class="swiper">
            <el-carousel trigger="click" :height="carouselHeight">
                <el-carousel-item v-for="(item, index) in swiper" :key="index">
                    <img :src="item.image" alt="" class="image_box" />
                </el-carousel-item>
            </el-carousel>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'topTop',

        data() {
            return {
                swiper: [],
                carouselHeight: '100vh',
            };
        },
        components: {},
        created() {},
        mounted() {
            // let carouselHeight = window.screen.height;
            // console.log('carouselHeight: ', carouselHeight);
            // this.carouselHeight = carouselHeight + 'px';
            this.getSwiper();
        },
        methods: {
            getSwiper() {
                this.$http
                    .get('/index/slider', { params: { status: '1' } })
                    .then((res) => {
                        console.log('res: ', res);
                        if (res.status == 200) {
                            this.swiper = res.data.slider;
                        }
                    })
                    .catch((err) => {});
            },
        },
    };
</script>

<style lang="less" scoped>
    .swiper {
        width: 100%;
        height: 100vh;
        .image_box {
            width: 100%;
            height: 100%;
        }
    }
</style>
